package com.app.app_service.service.impl;

import com.app.app_service.bean.ResultBean;
import com.app.app_service.dao.UserDao;
import com.app.app_service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by jiacheng on 2017/9/13.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public ResultBean getUserData(Long id) {
        ResultBean resultBean = new ResultBean();
        resultBean.setData(userDao.getOne(id));
        resultBean.setMessage("获取个人信息成功");
        resultBean.setResult(true);
        return resultBean;
    }

    @Override
    public ResultBean listUsers(String name) {
        ResultBean resultBean = new ResultBean();
        resultBean.setData(userDao.findUsersByNameLike("%"+name+"%"));
        resultBean.setMessage("模糊查询用户成功");
        resultBean.setResult(true);
        return resultBean;
    }
}
